import request from "@/utils/http/axios";

class UserApi {
    static getUserList(page=1, size=20){
        return request({
            url: "/user/userList",
            params: {page, size},
            method: "get"
        })
    }
    
    static getUserRole(userId){
        return request({
            url: "/user/role?userId="+userId,
            method: "get"
        })
    }

    static saveOrUpdate(user){
        return request({
            url: "/user/add",
            data: user,
            method: "post"
        })
    }

    static delUser(userId){
        return request({
            url: '/user/delete?userId='+userId,
            method: "delete"
        })
    }

    static searchUser(type, key){
        return request({
            url: '/user/search',
            method: "get",
            params: {type, key}
        })
    }

}

export default UserApi;
